package com.atguigu.gulimall.ware.dao;

import com.atguigu.gulimall.ware.entity.WareSkuEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 商品库存
 * 
 * @author DoGH
 * @since 2023-10-26 09:03:37
 */
@Mapper
public interface WareSkuDao extends BaseMapper<WareSkuEntity> {

    /**
     * 更新库存
     *
     * @param wareId 仓库ID
     * @param skuId  SKU ID
     * @param skuNum sku进货数
     * @author DuGuanghan
     * @since 2024-04-18 16:40:06
     */
    void updateSkuNum(@Param("wareId") Long wareId, @Param("skuId") Long skuId, @Param("skuNum") Integer skuNum);

    /**
     * 判断sku是否有库存
     * @param skuId SKU ID
     * @return {@link Integer }
     * @author DuGuanghan
     * @since 2024-04-18 16:28:57
     */
    Long getSkuHasStock(Long skuId);
}
